mas = open('m1_sorted.txt').read().split()
mas = list(map(int, mas))
mas2 = open('m2_reverse.txt').read().split()
mas2 = list(map(int, mas2))
mas3 = open('m3_shuffle.txt').read().split()
mas3 = list(map(int, mas3))
def q(mas):
    a = len(mas)
    for i in range(a):
        for j in range(a - 1):
            if mas[j] > mas[j + 1]:
                c = mas[j]
                mas[j] = mas[j + 1]
                mas[j + 1] = c
from time import*
f1 = time()
q(mas)
f2 = time()
g1 = time()
q(mas2)
g2 = time()
h1 = time()
q(mas3)
h2 = time()
print('m1_sorted', int((f2 - f1) * 1000), 'milliseconds')
print('m2_reverse', int((g2 - g1) * 1000), 'milliseconds')
print('m2_reverse', int((h2 - h1) * 1000), 'milliseconds')

